package io.lkt.task.config;

import io.lkt.task.task.process.articlePush.*;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QuartzConfig {

    @Bean
    public JobDetail pushJob430() {
        JobDetail jobDetail = JobBuilder.newJob(UploadTempMsgPushTask.class)
                .withIdentity("pushJob430","pushJobGroup430")
                //JobDataMap可以给任务execute传递参数
                .usingJobData("job_param","job_param430")
                .storeDurably()
                .build();
        return jobDetail;
    }

    @Bean
    public Trigger pushTrigger430() {
        Trigger trigger = TriggerBuilder.newTrigger()
                .forJob(pushJob430())
                .withIdentity("pushTrigger430","pushTriggerGroup430")
                .usingJobData("job_trigger430_param","job_trigger430_param1")
                .startNow()
                .withSchedule(CronScheduleBuilder.cronSchedule("0 30 4 * * ? *"))
                .build();
        return trigger;
    }

    @Bean
    public JobDetail pushJobSevenDetail() {
        JobDetail jobDetail = JobBuilder.newJob(UploadTempMsgPushTask.class)
                .withIdentity("pushJob7","pushJobGroup7")
                //JobDataMap可以给任务execute传递参数
                .usingJobData("job_param","job_param7")
                .storeDurably()
                .build();
        return jobDetail;
    }

    @Bean
    public Trigger pushTriggerSeven() {
        Trigger trigger = TriggerBuilder.newTrigger()
                .forJob(pushJobSevenDetail())
                .withIdentity("pushTrigger7","pushTriggerGroup7")
                .usingJobData("job_trigger7_param","job_trigger7_param1")
                .startNow()
                //.withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(5).repeatForever())
                .withSchedule(CronScheduleBuilder.cronSchedule("0 1 19 * * ? *"))
                .build();
        return trigger;
    }



}
